<?php
require_once ('admin.php');
$title = __('Import');
$parent_file = 'import.php';
require_once ('admin-header.php');
?>

<div class="wrap">
<h2><?php _e('Import Blog posts from other popular applications'); ?></h2>
<p><?php _e('If you have posts or comments from another blogging application you\'d like to import into mojoBlog, you -<i>might</i>- be able to import them using one of the import tools below.</p><h3 class=\'alert\'>Caution!</h3><p> Please, please make sure you\'ve backed up <em>ALL</em> critical information including your current joomla! database.</p><p>I\'m pretty sure at this phase in the beta release of mojoBlog, stuff is gonna break, and, if it does... It\'ll do it here!.'); ?></p>

<p><?php _e('Before mojoBlog becomes a stable, public release we should have importer plugins for the following CMS\'s and Blog apps.'); ?></p>
<ul>
<li>Joomla CMS</li>
<li>Mambo CMS</li>
<li>Drupal CMS</li>
<li>WordPress</li>
<li>WordPress.com (hosted)</li>
<li>and others..</li>
</ul>

<?php

// Load all importers so that they can register.
$import_loc = 'wp-admin/import';
$import_root = ABSPATH.$import_loc;
$imports_dir = @ dir($import_root);
if ($imports_dir) {
	while (($file = $imports_dir->read()) !== false) {
		if (preg_match('|^\.+$|', $file))
			continue;
		if (preg_match('|\.php$|', $file))
			require_once("$import_root/$file");
	}
}

$importers = get_importers();

if (empty ($importers)) {
	echo '<p>'.__('No mojoBlog importers are available yet, Soon! I am working on them as you read this.').'</p>'; // TODO: make more helpful
} else {
?>
<table width="100%" cellpadding="3" cellspacing="3">

<?php
	$style = '';
	foreach ($importers as $id => $data) {
		$style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
		$action = "<a href='admin.php?import=$id' title='{$data[1]}'>{$data[0]}</a>";

		if ($style != '')
			$style = 'class="'.$style.'"';
		echo "
			<tr $style>
				<td class=\"togl\">$action</td>
				<td class=\"desc\">{$data[1]}</td>
			</tr>";
	}
?>

</table>
<?php
}
?>

</div>

<?php

include ('admin-footer.php');
?>

